package com.example.lib_base.utils

import android.content.Context
import com.alibaba.android.arouter.facade.Postcard
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.facade.service.DegradeService
import com.alibaba.android.arouter.launcher.ARouter

/**
 * 全局降级策略  当路由目标不存在时，跳转到一个 Error界面
 */
@Route(path = "/service/degrade")
class MyDegrade:DegradeService {
    override fun init(context: Context?) {
        //初始化
    }

    override fun onLost(context: Context?, postcard: Postcard?) {
        //当页面迷失后  给他一个新的路径
        ARouter.getInstance().build("/app/ErrorActivity").navigation()
    }
}